package com.wmx.entity;

/**
 * @author:wmx 2025-03-10 09:41
 * 1、功能:
 * 2、参数{
 * <p>
 * <p>
 * }
 **/
public class ProgressThread extends Thread {

    /**
     * 拷贝文件的状态
     */
    private FileData fileData;

    public ProgressThread() {

    }

    public ProgressThread(FileData fileData) {
        this.fileData = fileData;
    }

    @Override
    public void run() {

        while (true) {

            if(this.fileData.getCopiedSize() == 0){
                continue;
            }
            double percent = this.fileData.getCopiedSize() * 1.0 / this.fileData.getTotalSize() * 100;
            System.out.printf("完成进度：%.2f %% %n",percent);


            try {
                Thread.sleep(1);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }


    }
}
